<?php
class Pembagian_pendamping extends CI_Model 
{

	function __construct()
	{
		parent::__construct();
	}

	function read($id)
	{
		$this->db->join('mr_pegawai','mr_pegawai.id_mr_pegawai = bagi_pendamping.id_mr_pegawai');
		$this->db->where('id_atur_kelas', $id);
		$query = $this->db->get('bagi_pendamping');		
		return $query->result();
	}	

	function add($dataInsert)
	{
		$query = $this->db->insert('bagi_pendamping', $dataInsert);
		return $query;
	}
	
	function delete($id)
	{
		$this->db->where('id_mr_pendamping', $id);
		$delete = $this->db->delete('bagi_pendamping');
		return $delete;
	}

	function atur_kelas($id){
		$this->db->where('id_atur_kelas', $id);
		$query = $this->db->get('atur_kelas');		
		return $query->row();
	}

	function pegawai($id){
		$this->db->where("id_mr_pegawai <> $id");
		$this->db->order_by('nm_pegawai');		
		$query=$this->db->get('mr_pegawai');
		return $query->result();
	}
}